const mysql = require("mysql");

const connection = mysql.createConnection({
    host:"localhost",
    user:"root",
    password:"hyx123456",
    database:"pet",
    timezone:"08:00"
})

// connection.connect();
function sqlFun(sql,arr,callback){
    connection.query(sql,arr,function(error,result){
        if(error){
            console.log('数据库链接失败'+ error);
            return;
        }
           callback(result);
    })
}
module.exports = sqlFun;
// connection.end();